/*
 * @package CreativeFramework
 * @generation Four
 * @purpose User Interface Javascript (Global)
 */
/**
 * Functions
 */
function toggleBasicTable(id)
{
	$("#basicTableCont-"+id).slideToggle(350, function(){
		img = document.getElementById("basicTableImg-"+id);
		if($("#basicTableCont-"+id).is(":hidden")) {
			img.src = img.src.replace(/minus/gi, "plus");
		}
		else{
			img.src = img.src.replace(/plus/gi, "minus");
		}
	});
}

function closeMessageBox(id)
{
	$("#msgBox-"+id).fadeOut(550);
}

function create_modal_dialog(t, c, rel)
{
	// t = title, c= content, rel = jquery trigger selector
	$(rel).click( function() {
		id = Math.floor(Math.random()*1000000);
		$("<div id='dialog-"+id+"' title='"+t+"'>"+c+"</div>").dialog( {
			bgiframe: true,
			height: 400,
			width: 550,
			modal: true,
			close: function(event, ui) {
				$(this).remove()
			}
		});
	});
}

function niceAlert(data, type){
	if(typeof type == "undefined" || !type) type = 0;
	box = $(".alert-msg-box");
	if(type == 1){
		box.removeClass("success-msg-box");
		box.addClass("error-msg-box");
	}
	else{
		box.removeClass("error-msg-box");
		if(type == 2) box.addClass("success-msg-box");
		else{
			box.removeClass("success-msg-box");
		}
	}
	box.html(data);
	box.fadeIn(1000, function(){
			box.fadeOut(1000)});
}

/**
 * Pagination System
 */


/**
 * Triggers
 */
$().ready(function(){
	Cufon.replace("h1");
	Cufon.replace("h2");
	
	// Tooltips now
	$("a[title]").qtip({
		content: {text:false},
		style: {
			border: {
				width: 1,
				radius: 5
			},
			padding: 3,
			tip: true,
			name: 'cream'
		}
	});
});
